package com.lcz.licence.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author lcz
 * @desc 拦截器配置
 * @mail lcz_0130@163.com
 * @date 2025/07/23
 */

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Resource
    private LicenseCheckInterceptor licenseCheckInterceptor;

    /**
     * 配置拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 向拦截器注册表中添加拦截器，并配置拦截的路径为所有请求
        registry.addInterceptor(licenseCheckInterceptor)
                .addPathPatterns("/**");
    }

}
